package com.isaiah.set;

import com.isaiah.tree.BSTree;

/**
 * @Title: 基于二分搜索树的集合实现
 * @Description: ${todo}
 * @author: Haijun
 * @emial: isaiah@sohu.com
 * @date 2020/4/2920:23
 */
public class BSTreeSet<E extends Comparable<E>> implements Set<E> {

    private BSTree<E> bst;

    public BSTreeSet() {
        this.bst = new BSTree<>();
    }


    @Override
    public void add(E e) {
        bst.add(e);
    }

    @Override
    public void remove(E e) {
        bst.remove(e);
    }

    @Override
    public boolean contains(E e) {
        return bst.contains(e);
    }

    @Override
    public int size() {
        return bst.size();
    }

    @Override
    public boolean isEmpty() {
        return bst.isEmpty();
    }
}
